function [ hasil ] = y_RK4( f, x0, y0, b, h )
%Y_RK4 Summary of this function goes here
%   Menghitung y(b) dengan metode Runge-Kutta orde empat pada PDB
%   y' = f(x,y); y(x0)=y0
    n = (b - x0)/h; %jumlah langkah
    y = y0;
    x = x0;
    syms a b;
    for r = 2 : n+1
        k1 = h * subs(f, [a b], [x y]);
        
        k2 = h * subs(f, [a b], [(x + h / 2) (y + k1 / 2)]);
        
        k3 = h * subs(f, [a b], [(x + h / 2) (y + k2 / 2)]);
        
        k4 = h * subs(f, [a b], [(x + h) (y + k3)]);
        
        y = y + (k1 + 2 * k2 + 2 * k3 + k4) / 6;
        x = x + h;
    end
    hasil = y;
end

